package com.itmei.springaopanno.config;

import com.itmei.springaopanno.annotation.Log;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.Arrays;

/**
 * @Author itmei
 * @Date 2022/12/19 15:10
 * @description: 切面注解
 * @Title: LogAspect
 * @Package com.itmei.springaopanno.config
 */
@Component
@Aspect
@Order(1)
public class LogAspect {

    @Before(value = "@annotation(log)")
    public void logBefore(JoinPoint joinPoint, Log log){
        System.out.println("----AOP增强接口----");
        System.out.println("请求接口参数："+Arrays.asList(joinPoint.getArgs()));
        System.out.println("接口的标题是："+log.title());
    }
}
